package com.weclud.service.impl;

import com.weclud.dao.mapper.AppConfigMapper;
import com.weclud.model.wechat.Categories;
import com.weclud.model.wechat.IndexImages;
import com.weclud.model.wechat.Notices;
import com.weclud.service.IConfigService;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
@CacheConfig(cacheNames="config")
public class ConfigServiceImpl implements IConfigService {
    @Autowired
    private AppConfigMapper appConfigMapper;

    @Override
    @Cacheable(key = "'categories'")
    public List<Categories> getAllCategories() {
        return appConfigMapper.getAllCategories();
    }

    @Override
    @Cacheable(key = "'index'")
    public List<IndexImages> getIndexImages() {
        return appConfigMapper.getIndexImages();
    }

    @Override
    @Cacheable(key = "'notice'")
    public List<Notices> getNotices() {
        return appConfigMapper.getNotices();
    }
}
